function GetChartsData() {

	var fieldStr = "";
	var nodeStr = "";
	var height = 200;

	$("#left-property-table tr td").each(function() {
		if ($(this).find("input[type=checkbox]:checked").val() != undefined) {
			fieldCode = $(this).find("input[type=checkbox]:checked").val();
			fieldStr += fieldCode + ",";
		}
	});

	var level = $("#chart-select").children('option:selected').val();
	var chartStyle = $("#chartStyle-select").children('option:selected').val();
	var nodes = treeObj.getCheckedNodes(true);
	for (var i = 0; i < nodes.length; i++) {
		if (nodes[i].level == level)
			nodeStr += nodes[i].id + ",";// 获取选中节点的值，并添加到数组中
	}
	
	$('#chart_show').html("");
	$('#chart_show').append("<div class='spinner'>" +
			"<div class='rect1'></div><div class='rect2'></div>" +
			"<div class='rect3'></div><div class='rect4'></div>" +
			"<div class='rect5'></div></div>"
			);

	$.ajax({
		url : './chart/showChart',
		type : 'post',
		data : {
			fieldStr : fieldStr,
			nodeStr : nodeStr,
			level : level,
			chartType : "line",
			chartStyle : chartStyle
		},
		dataType : 'json'
	}).done(
			function(data) {

				$('#chart_show').html("");
				if (chartStyle == "stack") {
					height = 400;
					$.each(data, function(i, item) {
						$('#chart_show').append(
								"<div id='" + item.divID + "' style='height: "
										+ height + "px'></div>");
						FunDraw(chartEC, item.echartData, item.divID,'5%');
					});
					
				} else {
					$.each(data, function(i, item) {
						$('#chart_show').append(
								"<div id='" + item.divID + "' class='singleChart' style='height: "
										+ height + "px'></div>");
						FunDraw(chartEC, item.echartData, item.divID);
					});
				}

			});

}

function chartdata_init() {

	var fieldStr = "QQ";
	var nodeStr = "延1评3井";
	var level = 3;
	var chartStyle = "line";
	var height = 200;

	$.ajax({
		url : './chart/showChart',
		type : 'post',
		data : {
			fieldStr : fieldStr,
			nodeStr : nodeStr,
			level : level,
			chartType : "line",
			chartStyle : chartStyle
		},
		dataType : 'json'
	}).done(
			function(data) {

				$('#chart_show').html("");
				$.each(data, function(i, item) {
					$('#chart_show').append(
							"<div id='" + item.divID + "' class='singleChart' style='height: "
									+ height + "px'></div>");
					FunDraw(chartEC, item.echartData, item.divID);
				});

			});

}

function DrawCharts(ec) {

	chartEC = ec;

	/*
	 * var strs = new Array(); strs[0] = [ '邮件营销', '联盟广告', '视频广告', '直接访问',
	 * '搜索引擎', ]; strs[1] = [ 'line', 'bar', 'stack', 'tiled' ]; strs[2] = [
	 * '2012-11-01', '2012-11-02', '2012-11-03', '2012-11-04', '2012-11-05',
	 * '2012-11-06', '2012-11-07', ]; strs[3] = [ { name : '邮件营销', type :
	 * 'line', stack : '总量', itemStyle: {normal: {areaStyle: {type:
	 * 'default'}}}, data : [ 120, 132, 101, 134, 90, 230, 210 ] }, { name :
	 * '联盟广告', type : 'line', stack : '总量', itemStyle: {normal: {areaStyle:
	 * {type: 'default'}}}, data : [ 220, 182, 191, 234, 290, 330, 310 ] }, {
	 * name : '视频广告', type : 'line', stack : '总量', itemStyle: {normal:
	 * {areaStyle: {type: 'default'}}}, data : [ 150, 232, 201, 154, 190, 330,
	 * 410 ] }, { name : '直接访问', type : 'line', stack : '总量', itemStyle:
	 * {normal: {areaStyle: {type: 'default'}}}, data : [ 320, 332, 301, 334,
	 * 390, 330, 320 ] }, { name : '搜索引擎', type : 'line', stack : '总量',
	 * itemStyle: {normal: {areaStyle: {type: 'default'}}}, data : [ 820, 932,
	 * 901, 934, 1290, 1330, 1320 ] } ];
	 * 
	 *  // 基于准备好的dom，初始化echarts图表 var myChart =
	 * ec.init(document.getElementById("test"));
	 * 
	 * option = { title : { text : "叠合图", x : 'right', y : 'center' }, tooltip : {
	 * trigger : 'axis' }, legend : {// 图例 show : true, data : strs[0] }, grid : {
	 * x : '10%', y : '15%', x2 : '20%', y2 : '10%' }, toolbox : { show : true,
	 * x : 'right', y : 30, feature : {
	 * 
	 * dataView : { show : true, readOnly : false }, magicType : { show : true,
	 * type : strs[1] }, restore : { show : true }, mark : { show : true },
	 * 
	 * dataZoom : { show : true },
	 * 
	 * magicType : { show : true, type : strs[1] },
	 * 
	 * restore : { show : true }, saveAsImage : { show : true } } }, calculable :
	 * false,// 是否启用拖拽 xAxis : [ { type : 'category', boundaryGap : false, data :
	 * strs[2] } ], yAxis : [ { type : 'value' } ], series : strs[3] };
	 *  // 为echarts对象加载数据 myChart.setOption(option);
	 */

}

function FunDraw(ec, item, id, postion) {

	postion = postion || '5%';
	
	// 基于准备好的dom，初始化echarts图表
	var myChart = ec.init(document.getElementById(id));

	option = {
		title : {
			text : item.showName,
			x : 'left',
			y : 'top'
		},
		tooltip : {
			trigger : 'axis'
		},
		legend : {// 图例
			show : true,
			data : item.legend
		},
		grid : {
			x : '10%',
			y : '15%',
			x2 : postion,
			y2 : '10%'
		},
		toolbox : {
			orient:'vertical',
			show : true,
			x : 'right',
			y : 30,
			feature : {
				/*
				 * dataView : { show : true, readOnly : false }, magicType : {
				 * show : true, type : strs[1] }, restore : { show : true },
				 * mark : { show : true },
				 */
				dataZoom : {
					show : true
				},
				/*
				 * magicType : { show : true, type : strs[1] },
				 */
				restore : {
					show : true
				},
				saveAsImage : {
					show : true
				}
			}
		},
		calculable : false,// 是否启用拖拽
		xAxis : [ {
			type : 'category',
			boundaryGap : false,
			data : item.xAxis
		} ],
		yAxis : [ {
			type : 'value',
		} ],
		series : item.series
	};

	// 为echarts对象加载数据
	myChart.setOption(option);
}